From 76e115b91035215871094121a9dfb5a4b11f476a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 21 Feb 2020 22:03:28 -0500 Subject: [PATCH] Add a warning when a grab fails This reveals that the grabs for popover menus always fail now, causing the menus to not properly hide. --- gdk/wayland/gdksurface-wayland.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 2174bdf72a..c761611dbc 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -2799,18 +2799,28 @@ gdk_wayland_surface_present_popup (GdkSurface *surface, if (surface->autohide) { GrabPrepareData data; + GdkGrabStatus result; data = (GrabPrepareData) { .width = width, .height = height, .layout = layout, }; - gdk_seat_grab (gdk_display_get_default_seat (surface->display), - surface, - GDK_SEAT_CAPABILITY_ALL, - TRUE, - NULL, NULL, - show_grabbing_popup, &data); + + result = gdk_seat_grab (gdk_display_get_default_seat (surface->display), + surface, + GDK_SEAT_CAPABILITY_ALL, + TRUE, + NULL, NULL, + show_grabbing_popup, &data); + if (result != GDK_GRAB_SUCCESS) + { + const char *grab_status[] = { + "success", "already grabbed", "invalid time", + "not viewable", "frozen", "failed" + }; + g_warning ("Grab failed: %s", grab_status[result]); + } } else { -- 2.30.2